load("@build_bazel_rules_android//android:rules.bzl", "android_library")

licenses(["notice"])

package(default_visibility = ["//visibility:public"])

java_library(
    name = "aes_gcm_key_manager",
    srcs = ["AesGcmKeyManager.java"],
    deps = [
        "//proto:aes_gcm_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/config/internal:tink_fips_util",
        "//src/main/java/com/google/crypto/tink/subtle:aes_gcm_jce",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aes_gcm_siv_key_manager",
    srcs = ["AesGcmSivKeyManager.java"],
    deps = [
        "//proto:aes_gcm_siv_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/aead/subtle:aes_gcm_siv",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aead_key_templates",
    srcs = ["AeadKeyTemplates.java"],
    deps = [
        ":aes_ctr_hmac_aead_key_manager",
        ":aes_eax_key_manager",
        ":aes_gcm_key_manager",
        ":cha_cha20_poly1305_key_manager",
        ":kms_aead_key_manager",
        ":kms_envelope_aead_key_manager",
        ":x_cha_cha20_poly1305_key_manager",
        "//proto:aes_ctr_hmac_aead_java_proto",
        "//proto:aes_ctr_java_proto",
        "//proto:aes_eax_java_proto",
        "//proto:aes_gcm_java_proto",
        "//proto:common_java_proto",
        "//proto:hmac_java_proto",
        "//proto:kms_aead_java_proto",
        "//proto:kms_envelope_java_proto",
        "//proto:tink_java_proto",
    ],
)

java_library(
    name = "aes_ctr_hmac_aead_key_manager",
    srcs = ["AesCtrHmacAeadKeyManager.java"],
    deps = [
        ":aes_ctr_key_manager",
        "//proto:aes_ctr_hmac_aead_java_proto",
        "//proto:aes_ctr_java_proto",
        "//proto:common_java_proto",
        "//proto:hmac_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:mac",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/mac:hmac_key_manager",
        "//src/main/java/com/google/crypto/tink/config/internal:tink_fips_util",
        "//src/main/java/com/google/crypto/tink/subtle:encrypt_then_authenticate",
        "//src/main/java/com/google/crypto/tink/subtle:ind_cpa_cipher",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aead_factory",
    srcs = ["AeadFactory.java"],
    deps = [
        ":aead_wrapper",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink:registry_cluster",
    ],
)

java_library(
    name = "kms_aead_key_manager",
    srcs = ["KmsAeadKeyManager.java"],
    deps = [
        "//proto:kms_aead_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:kms_client",
        "//src/main/java/com/google/crypto/tink:kms_clients",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "kms_envelope_aead",
    srcs = ["KmsEnvelopeAead.java"],
    deps = [
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:registry",
    ],
)

java_library(
    name = "x_cha_cha20_poly1305_key_manager",
    srcs = ["XChaCha20Poly1305KeyManager.java"],
    deps = [
        "//proto:tink_java_proto",
        "//proto:xchacha20_poly1305_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "//src/main/java/com/google/crypto/tink/subtle:x_cha_cha20_poly1305",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aead_wrapper",
    srcs = ["AeadWrapper.java"],
    deps = [
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:crypto_format",
        "//src/main/java/com/google/crypto/tink:primitive_set",
        "//src/main/java/com/google/crypto/tink:primitive_wrapper",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:bytes",
    ],
)

java_library(
    name = "kms_envelope_aead_key_manager",
    srcs = ["KmsEnvelopeAeadKeyManager.java"],
    deps = [
        ":kms_envelope_aead",
        "//proto:kms_envelope_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:kms_client",
        "//src/main/java/com/google/crypto/tink:kms_clients",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aes_ctr_key_manager",
    srcs = ["AesCtrKeyManager.java"],
    deps = [
        "//proto:aes_ctr_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:aes_ctr_jce_cipher",
        "//src/main/java/com/google/crypto/tink/subtle:ind_cpa_cipher",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "cha_cha20_poly1305_key_manager",
    srcs = ["ChaCha20Poly1305KeyManager.java"],
    deps = [
        "//proto:chacha20_poly1305_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:cha_cha20_poly1305",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aes_eax_key_manager",
    srcs = ["AesEaxKeyManager.java"],
    deps = [
        "//proto:aes_eax_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:aes_eax_jce",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "aead_config",
    srcs = ["AeadConfig.java"],
    deps = [
        ":aead_wrapper",
        ":aes_ctr_hmac_aead_key_manager",
        ":aes_eax_key_manager",
        ":aes_gcm_key_manager",
        ":aes_gcm_siv_key_manager",
        ":cha_cha20_poly1305_key_manager",
        ":kms_aead_key_manager",
        ":kms_envelope_aead_key_manager",
        ":x_cha_cha20_poly1305_key_manager",
        "//proto:config_java_proto",
        "//src/main/java/com/google/crypto/tink/config:tink_fips",
        "//src/main/java/com/google/crypto/tink/mac:mac_config",
    ],
)

# Android libraries

android_library(
    name = "aes_gcm_key_manager-android",
    srcs = ["AesGcmKeyManager.java"],
    deps = [
        "//proto:aes_gcm_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/config/internal:tink_fips_util-android",
        "//src/main/java/com/google/crypto/tink/subtle:aes_gcm_jce",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aes_gcm_siv_key_manager-android",
    srcs = ["AesGcmSivKeyManager.java"],
    deps = [
        "//proto:aes_gcm_siv_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/aead/subtle:aes_gcm_siv",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aead_key_templates-android",
    srcs = ["AeadKeyTemplates.java"],
    deps = [
        ":aes_ctr_hmac_aead_key_manager-android",
        ":aes_eax_key_manager-android",
        ":aes_gcm_key_manager-android",
        ":cha_cha20_poly1305_key_manager-android",
        ":kms_aead_key_manager-android",
        ":kms_envelope_aead_key_manager-android",
        ":x_cha_cha20_poly1305_key_manager-android",
        "//proto:aes_ctr_hmac_aead_java_proto_lite",
        "//proto:aes_ctr_java_proto_lite",
        "//proto:aes_eax_java_proto_lite",
        "//proto:aes_gcm_java_proto_lite",
        "//proto:common_java_proto_lite",
        "//proto:hmac_java_proto_lite",
        "//proto:kms_aead_java_proto_lite",
        "//proto:kms_envelope_java_proto_lite",
        "//proto:tink_java_proto_lite",
    ],
)

android_library(
    name = "aes_ctr_hmac_aead_key_manager-android",
    srcs = ["AesCtrHmacAeadKeyManager.java"],
    deps = [
        ":aes_ctr_key_manager-android",
        "//proto:aes_ctr_hmac_aead_java_proto_lite",
        "//proto:aes_ctr_java_proto_lite",
        "//proto:common_java_proto_lite",
        "//proto:hmac_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:mac",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/config/internal:tink_fips_util-android",
        "//src/main/java/com/google/crypto/tink/mac:hmac_key_manager-android",
        "//src/main/java/com/google/crypto/tink/subtle:encrypt_then_authenticate",
        "//src/main/java/com/google/crypto/tink/subtle:ind_cpa_cipher",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aead_factory-android",
    srcs = ["AeadFactory.java"],
    deps = [
        ":aead_wrapper-android",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink:registry_cluster-android",
    ],
)

android_library(
    name = "kms_aead_key_manager-android",
    srcs = ["KmsAeadKeyManager.java"],
    deps = [
        "//proto:kms_aead_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:kms_client",
        "//src/main/java/com/google/crypto/tink:kms_clients",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "kms_envelope_aead-android",
    srcs = ["KmsEnvelopeAead.java"],
    deps = [
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:registry-android",
    ],
)

android_library(
    name = "x_cha_cha20_poly1305_key_manager-android",
    srcs = ["XChaCha20Poly1305KeyManager.java"],
    deps = [
        "//proto:tink_java_proto_lite",
        "//proto:xchacha20_poly1305_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "//src/main/java/com/google/crypto/tink/subtle:x_cha_cha20_poly1305",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aead_wrapper-android",
    srcs = ["AeadWrapper.java"],
    deps = [
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:crypto_format-android",
        "//src/main/java/com/google/crypto/tink:primitive_set-android",
        "//src/main/java/com/google/crypto/tink:primitive_wrapper-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:bytes",
    ],
)

android_library(
    name = "kms_envelope_aead_key_manager-android",
    srcs = ["KmsEnvelopeAeadKeyManager.java"],
    deps = [
        ":kms_envelope_aead-android",
        "//proto:kms_envelope_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:kms_client",
        "//src/main/java/com/google/crypto/tink:kms_clients",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aes_ctr_key_manager-android",
    srcs = ["AesCtrKeyManager.java"],
    deps = [
        "//proto:aes_ctr_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:aes_ctr_jce_cipher",
        "//src/main/java/com/google/crypto/tink/subtle:ind_cpa_cipher",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "cha_cha20_poly1305_key_manager-android",
    srcs = ["ChaCha20Poly1305KeyManager.java"],
    deps = [
        "//proto:chacha20_poly1305_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:cha_cha20_poly1305",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aes_eax_key_manager-android",
    srcs = ["AesEaxKeyManager.java"],
    deps = [
        "//proto:aes_eax_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:aes_eax_jce",
        "//src/main/java/com/google/crypto/tink/subtle:random",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "aead_config-android",
    srcs = ["AeadConfig.java"],
    deps = [
        ":aead_wrapper-android",
        ":aes_ctr_hmac_aead_key_manager-android",
        ":aes_eax_key_manager-android",
        ":aes_gcm_key_manager-android",
        ":aes_gcm_siv_key_manager-android",
        ":cha_cha20_poly1305_key_manager-android",
        ":kms_aead_key_manager-android",
        ":kms_envelope_aead_key_manager-android",
        ":x_cha_cha20_poly1305_key_manager-android",
        "//proto:config_java_proto_lite",
        "//src/main/java/com/google/crypto/tink/config:tink_fips-android",
        "//src/main/java/com/google/crypto/tink/mac:mac_config-android",
    ],
)
